package com.bjh;

import com.bjh.config.ZkPropertiesSource;
import com.bjh.netty.server.RpcServer;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class NettyServerApp implements ApplicationRunner {

    @Resource
    private ZkPropertiesSource zkPropertiesSource;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        RpcServer rpcServer = new RpcServer(zkPropertiesSource.getNettyServerPort());
        /**
         * 启动Netty Server服务端，监听客户端请求
         */
        rpcServer.start();
    }
}
